import React from 'react';
import { Row, Col } from 'antd';
import _ from 'lodash';
import { useTranslation } from 'react-i18next';

interface Props {
  data: any;
}
export default function Index(props: Props) {
  const { t } = useTranslation('datasourceManage');
  const { data } = props;

  return (
    <div data-oid='fjjrx95'>
      <div className='page-title' data-oid='pup0jxg'>
        HTTP
      </div>
      <div className='flash-cat-block' data-oid='h_lro1n'>
        <Row gutter={16} data-oid='qy4:7y8'>
          <Col span={24} data-oid='aqytksu'>
            URL：
          </Col>
          <Col span={24} className='second-color' data-oid='5l4gebk'>
            {data?.http?.url}
          </Col>
        </Row>
      </div>
      <div className='page-title' data-oid='zw6mzix'>
        {t('form.auth')}
      </div>
      <div className='flash-cat-block' data-oid='hyfvmkf'>
        <Row gutter={16} data-oid='2_0kfh9'>
          <Col span={8} data-oid='rh_53.4'>
            {t('form.username')}：
          </Col>
          <Col span={8} data-oid='---:7s.'>
            {t('form.password')}：
          </Col>
          <Col span={8} data-oid='2279dsy'>
            {t('form.skip_ssl_verify')}：
          </Col>
          <Col span={8} className='second-color' data-oid='0uhwpek'>
            {data?.auth?.basic_auth ? data?.auth?.basic_auth_user : '-'}
          </Col>
          <Col span={8} className='second-color' data-oid='s73hxfa'>
            {data?.auth?.basic_auth ? '******' : '-'}
          </Col>
          <Col span={8} className='second-color' data-oid='mra8moe'>
            {data.http?.tls?.skip_tls_verify ? t('form.yes') : t('form.no')}
          </Col>
        </Row>
      </div>
      {!_.isEmpty(data?.http?.headers) && (
        <>
          <div className='page-title' data-oid='yr8kz0k'>
            {t('form.headers')}
          </div>
          <div className='flash-cat-block' data-oid='q.35nj6'>
            <Row gutter={16} data-oid='4zk5fvc'>
              {_.map(data?.http?.headers, (val, key) => {
                return (
                  <Col key={key} span={24} data-oid='9:9lbqd'>
                    {key + ' : ' + val}
                  </Col>
                );
              })}
            </Row>
          </div>
        </>
      )}
      <div className='page-title' data-oid='ng6buo.'>
        {t('form.other')}
      </div>
      <div className='flash-cat-block' data-oid='naseih0'>
        <Row gutter={16} data-oid='nm24-hx'>
          <Col span={24} data-oid='.av_0pa'>
            {t('form.jaeger.version')}：
          </Col>
          <Col span={24} className='second-color' data-oid='pjm:36q'>
            {data.settings?.version || '-'}
          </Col>
        </Row>
      </div>
    </div>
  );
}
